﻿using System;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
using Graphe.Collations;

namespace Graphe.Windows.Controls.Collations
{
    public class CollationControl : StackPanel
    {
        public CollationControl()
        {
            Loaded += new RoutedEventHandler(CollationControl_Loaded);
        }

        #region Public Static Properties

        public static int ControlVersionId { get; set; }
        public static CollationControlController Controller { get; set; }


        #endregion

        public int ControlVersion
        {
            set
            {
                ControlVersionId = value;
            }
        }

        private void CollationControl_Loaded(object sender, RoutedEventArgs e)
        {
            Controller = CollationControlController.Instance;
        }


        public void Display(Collation collation)
        {

            Controller.HideAllButtons();
            Controller.Collation = collation;
            Children.Clear();

            foreach (Verse verse in collation.Verses)
            {
                VerseControl verseControl = new VerseControl();
                verseControl.Verse = verse;

                Border border = new Border();
                border.Style = CollationsControlStylePicker.FindProperVersionResource("VerseSeparator") as Style;

                verseControl.Render();

                Children.Add(border);
                Children.Add(verseControl);
            }


        }

    }
}
